package com.catmiao.spark.acc

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 * @title: Spark01_RDD_Dep
 * @projectName spark_study
 * @description: TODO
 * @author ChengMiao
 * @date 2024/2/28 23:20
 */
object Spark01_Acc {


  def main(args: Array[String]): Unit = {
    val sparkCon = new SparkConf().setMaster("local[*]").setAppName("acc")

    val sparkContext = new SparkContext(sparkCon)

    val rdd = sparkContext.makeRDD(List(1, 2, 3, 4))

    // reduce：分区内计算，分区间计算
    val result = rdd.reduce(_ + _)
    println(result)

    sparkContext.stop()
  }
}
